<?php
// vim: set ts=4 sw=4 sts=4 et:

/**
 * PHP version 5.3.0
 * 
 * @category  allyoung
 * @author    ____author____ 
 * @copyright ____copyright____
 * @license   ____license____
 * @version   GIT: $Id
 * @link      http://www.vmrf.ru/
 * @see       ____file_see____
 * @since     1.0.0
 */

namespace AY\Widget;

/**
 * Abstract widget 
 * 
 * @see   ____class_see____
 * @since 1.0.0
 */
abstract class AWidget extends \WP_Widget{
    
    protected $widgetName;
    protected $widgetOptions;
    public function __construct() {
        add_action('wp_ajax_nopriv_' . $this->widgetName, array(&$this,'ajaxAction' ));
       add_action('wp_ajax_' . $this->widgetName, array(&$this,'ajaxAction' ));
  parent::__construct('allyong' . $this->widgetName, $this->widgetName, $this->widgetOptions, $control_options);
    }
    
    public function widget($args, $instance) {

        parent::widget($args, $instance);
    }
    
    public function update($new_instance, $old_instance) {
    
        parent::update($new_instance, $old_instance);
    }
   
    public function form($instance) {

        parent::form($instance);
    }
    
    public function ajaxAction() {
           //header("Content-type:application/json; charset=UTF-8"); 
        $answer = json_encode($this->ajax());
        print($answer);
        die();
    }
    /*
    * Обработчик ajax событий
    */
    
    public function ajax() {
    return;     
    }
}
